const  CompressionPlugin =require('compression-webpack-plugin')
const {  name  } = require('../package.json')
//const {  name2  } = require('./package.json')
const name2 = 'auth1.0'
module.exports = {
    publicPath: `/subapp/${name2}`,
    outputDir:`${name2}`,
    //baseUrl:process.env.NODE_ENV ==='production' ? './':'',
    productionSourceMap:process.env.NODE_ENV === 'production' ? false :true,
    transpileDependencies:[
        'sm-crypto','js-base64','common','crypto-js'
    ],
  chainWebpack: config => config.resolve.symlinks(false),
    configureWebpack: {
        resolve: {
            alias: {
                'assets': '@/assets',
                'api': '@/api',
                'libs': '@/libs',
                'module': '@/components',
                'views': '@/views',
                'src': '@/'
            }
        },
      plugins:[
        new CompressionPlugin({
          algorithm:'gzip',
          test:/\.js$|\.html$\.css$/,
          filename:'[path].gz[query]',
          minRatio: 1,
          threshold:10240,
          deleteOriginalAssets: false,
        })
      ],
      output: {
        // 把子应用打包成 umd 库格式
        library: `${name}-[name]`,
        libraryTarget: 'umd',
        jsonpFunction: `webpackJsonp_${name}`
      }
    },
    lintOnSave: false,
    css: {
        loaderOptions: {
            less: {
                javascriptEnabled: true,
            }
        }
    },
    devServer: {
        proxy: {
          '/sysconf': {
                target: "http://192.0.10.17:8002", //对应自己的接口
                secure:false,
                ws: true,
                changeOrigin: true,
                pathRewrite: {
                    '^/sysconf': '/sysconf'
                }
            }
        },
      port: process.env.VUE_APP_PORT,
      headers: {
        'Access-Control-Allow-Origin': '*'
      },
		// 此处开启 https
    //https: fals
    }
}
